package com.orilore.gb.web;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.orilore.gb.biz.XEmployeeBiz;

/**
 * Servlet implementation class UpdateXEmployeeServlet
 */
public class UpdateXEmployeeServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public UpdateXEmployeeServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
		request.setCharacterEncoding("UTF-8");
		
		
		String id = request.getParameter("id");
		
        String ename = request.getParameter("ename");
		
		String age = request.getParameter("age");
		
		String sex = request.getParameter("sex");
		
		String did = request.getParameter("did");
		
		String salary = request.getParameter("salary");
		
		String address = request.getParameter("address");
		
		
		XEmployeeBiz  biz = new XEmployeeBiz();
		
		
		boolean flag = biz.UpdateEmployeeBiz(Integer.parseInt(id), ename, Integer.parseInt(sex), Integer.parseInt(age), Double.parseDouble(salary), address, Integer.parseInt(did));
		
		
	    if(flag) {
	    	

	    	  response.sendRedirect("QueryEmployeePageServlet?curpage=1&sex=2&did=-1");
	    	
	    	
	    }
	    
	  
		
		
		
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
